#ifndef REGISTERDIALOG_H
#define REGISTERDIALOG_H

#include <QDialog>
#include "global.h"

namespace Ui {
class registerDialog;
}

class registerDialog : public QDialog
{
    Q_OBJECT

public:
    explicit registerDialog(QWidget *parent = nullptr);
    ~registerDialog();

private slots:
    void on_get_code_btn_clicked();
    void slot_reg_mod_finish(ReqId id,QString res,ErrorCodes err);

    void on_sure_btn_clicked();

signals:
    void sinals_switch_to_login();

private:
    void showTip(const QString& str,bool ok);
    Ui::registerDialog *ui;
    void initHttpHandlers();
    QMap<ReqId,std::function<void(const QJsonObject&)>> _handlers;
    QMap<TipErr,QString> _tip_errs;
    void AddTipErr(TipErr te,QString tips);
    void DelTipErr(TipErr te);
    bool checkUserValid();
    bool checkPassValid();
    bool checkEmailValid();
    bool checkVarifyValid();
    bool checkPassVarifyValid();
};

#endif // REGISTERDIALOG_H
